package com.ctshk.sapp.order.localfun.controller;


import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.web.support.BaseController;
import com.ctshk.rpc.order.localfun.dto.LocalFunOrderCollectionReceiptDTO;
import com.ctshk.rpc.order.localfun.req.LocalFunOrderReceiptAddReq;
import com.ctshk.rpc.order.localfun.req.LocalFunOrderReceiptModifyReq;
import com.ctshk.rpc.order.localfun.req.LocalFunOrderReceiptReq;
import com.ctshk.rpc.order.localfun.service.ILocalFunOrderReceiptService;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 订单-收据表 前端控制器
 * </p>
 *
 * @author gzl-wansi001
 * @since 2021-03-25
 */
@RestController
@RequestMapping("/local-fun-order-receipt")
public class LocalFunOrderReceiptController extends BaseController {
    @DubboReference
    private ILocalFunOrderReceiptService iLocalFunOrderCollectionService;

    @ApiOperation(value = "订单中心 - 新增收据", notes = "订单中心 - 新增收据")
    @OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.ADD, operTitle = "订单中心 - 新增收据", operDesc = "订单中心 - 新增收据")
    @PostMapping(value = "/add")
    public Result<Long> add(@RequestBody LocalFunOrderReceiptAddReq scenicOrderReceiptAddReq){
        return iLocalFunOrderCollectionService.add(scenicOrderReceiptAddReq,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "订单中心 - 修改收据", notes = "订单中心 - 修改收据")
    @OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.UPDATE, operTitle = "订单中心 - 修改收据", operDesc = "订单中心 - 修改收据")
    @PostMapping(value = "/modify")
    public Result<Long> modify(@RequestBody LocalFunOrderReceiptModifyReq scenicOrderReceiptModifyReq){
        return iLocalFunOrderCollectionService.modify(scenicOrderReceiptModifyReq,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "订单中心 - 收据详情", notes = "订单中心 - 收据详情")
    @OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.QUERY, operTitle = "订单中心 - 收据", operDesc = "订单中心 - 收据")
    @PostMapping(value = "/collection-receipt")
    public Result<LocalFunOrderCollectionReceiptDTO> collectionReceipt(@RequestBody LocalFunOrderReceiptReq localFunOrderReceiptReq){
        return iLocalFunOrderCollectionService.collectionReceipt(localFunOrderReceiptReq,getCurrentUser(getRequest()));
    }
}
